POV-Ray : Newsgroups : povray.general : normals and textures using texture_map : Re: normals and textures using texture_map Server Time
1 Aug 2024 18:21:55 EDT (-0400)
  Re: normals and textures using texture_map  
From: PM 2Ring
Date: 6 Jul 2005 07:45:00
Message: <web.42cbc31df229687430757dd90@news.povray.org>
Here's the isosurface version. As expected, it renders much slower than the
normals version. If you make the accuracy much smaller than 0.0075, you
will have to push the max_gradient right up and render speeds become
glacial, especially with high AA settings.

// Persistence of Vision Ray Tracer Scene Description File
//
//  From: Ross
//  Subject: normals and textures using texture_map
//  Date: 1 Jul 2005 21:54:37
//  Message: <42c5bb9d@news.povray.org>
//
//    I have a normal "myNormal", created from a pigment function "fnPig"
that I
//  want to apply to a texture "t3", but i want to apply the normal after
I'm
//  done doing the warp & scale loop. "t3" is a texture created with a
//  "texture_map" of two textures "t1" and "t2".
//
//  Is it possible to apply a normal on "t3" (see comment in "t3") without
//  specifying a normal on "t1" and "t2"? If so, how?
//
//  thanks,
//  ross
//
//  Modified by PM 2Ring
//  Isosurface version 2005.07.04
//
//  -D +A0.1 +AM2 +R2
//  -F -A0.5 +AM2 +R1
//

#include "functions.inc"

global_settings {
  assumed_gamma 1.0
  max_trace_level 7
}

#declare Step = 8;
#declare Turb = <0.34, 0.3, 0.7>;

#declare Pig =
pigment {
  leopard scale 0.15
  #declare I = Step;
  #while (I > 0)
    warp {repeat x flip y}
    warp {turbulence Turb}
    scale 1.2
    #declare I = I - 1;
  #end
}

#declare fnPig = function {pigment {Pig}}

#declare Dull =  finish { specular 1 roughness 0.003 diffuse 0.3 reflection
{0.2, 0.4 fresnel on} }
#declare Shiny = finish { specular 0.6 roughness 0.03 diffuse 0.3 }

#declare t1 = texture {pigment {rgb 1} finish { Dull } }
#declare t2 = texture {pigment {rgb 0.2} finish { Shiny } }

#declare t3 =
 texture {
  function {fnPig(x, y, z).x}
  texture_map {
   [0.0 t1]
   [1.0 t2]
  }
}

/**** test scene ****/
camera {
  right x*image_width/image_height

  //location  <0, 6, -10>
  //look_at   <0,5,0>

  location  <0, 3, -12>
  look_at   <0,2,0>
  angle 30
}

light_source {
  <200,400,-350>
  rgb 1
}

sky_sphere {
  pigment {
    gradient y  scale .7
    color_map {
      [0.0 rgb <0.6,0.7,1.0>]
      [0.7 rgb <0.0,0.1,0.8>]
    }
  }
}

plane {
  y, 0
  texture { pigment {rgb <0.65, 1, 0.36>} }
}

#declare IsoDepth = 0.035;
isosurface{
  function {f_sphere(x,y-2,z-2, 2 + IsoDepth*(fnPig(x,y,z).x-1))}
  contained_by{sphere {<0, 2, 2>, 2}}
  accuracy 0.0075
  max_gradient 9.9

  texture {t3}
  interior { ior 1.455 }   //So Fresnel works
}

//Some objects to reflect in the ball
#macro Post(A,C)cylinder{A, A+4*y, 0.5 pigment{C}finish{specular .75
roughness 0.01}} #end

Post(-2.4*x, red 1)
Post(2.4*x, blue 1)

//------------------------------------------------------------

See "Isosurface from Warped Pigment" in p.b.i for a 1024x768 .jpg


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.